/**
 * @file birth_time.h
 * @brief Brief description of birth_time.h
 * @author achdu0000@163.com
 * @version 1.0.0
 * @date 2024/07/07
 */

#ifndef BIRTH_TIME_H
#define BIRTH_TIME_H

#include <Arduino.h>
#include <lvgl.h>
#include "../../color_config/color_config.h"
#include "../../constants.h"

/**
 * get basic icon (people with heart) obj
 */
lv_obj_t *get_basic_icon_people_with_heart_obj();

/**
 * set birth time value
 * @param birth_year                the year to set (e.g., 2024)
 * @param birth_month               the month to set (1-12)
 * @param birth_day                 the day to set (1-31)
 * @param birth_hour                the hour to set (0-23)
 * @param birth_min                 the minute to set (0-59)
 * @param birth_year_ganzhi_str     the ganzhi of birth year (default, `nullptr`)
 * @param birth_jieqi_str           the jieqi of birth day (default, `nullptr`)
 * @param birth_wuhou_index         the wu hou index of birth day (1, 2, 3) (default, `0xff`)
 * @return                          true if success
 *
 */
bool set_birth_time_val(uint16_t birth_year, uint8_t birth_month, uint8_t birth_day, uint8_t birth_hour, uint8_t birth_min, const char *birth_year_ganzhi_str = nullptr, const char *birth_jieqi_str = nullptr, uint8_t birth_wuhou_index = 0xff);

/**
 * set body temperature value
 * @param body_temperature          the body temperature with one decimal place (e.g. 365 means 36.5°C)
 * @return                          true if success
 */
bool set_body_temperature_val(uint16_t body_temperature);

/**
 * set body blood press value
 * @param body_blood_press_h        the value of blood press high part
 * @param body_blood_press_l        the value of blood press low part
 * @return                          true if success
 */
bool set_body_blood_press_val(uint8_t body_blood_press_h, uint8_t body_blood_press_l);

/**
 * set body blood oxygen percent value
 * @param body_blood_oxygen         the percent of blood oxygen (0-100)
 * @return                          true if success
 */
bool set_body_blood_oxygen_val(uint8_t body_blood_oxygen);

/**
 * set body hearrt rate value
 * @param body_heart_rate           the value of body heart rate
 * @return                          true if success
 */
bool set_body_heart_rate_val(uint8_t body_heart_rate);

/**
 * set body walk step value (in one day)
 * @param body_walk_step            the value of body walk step
 * @return                          true if success
 */
bool set_body_walk_step_val(uint16_t body_walk_step);

/**
 * set body state value
 * @param body_state_str            the body state str (e.g. "疲惫", "饥饿", "忧思", "喜乐")
 * @return                          true if success
 */
bool set_body_state_str(const char *body_state);

/**
 * set ganzhi of day (now)
 * @param day_ganzhi_s              the string of ganzhi string in Chinese, like "甲子", "乙丑", ...
 * @return                          true if success
 */
bool set_now_day_ganzhi(const char *day_ganzhi_s);

/**
 * set yin yang value of body
 * @param yin_value                 the value of yin (0-100)
 * @param yang_value                the value of yang (0-100)
 */
bool set_body_yinyang_val(uint8_t yin_value,uint8_t yang_value);

/**
 * get ganzhi of day (now)
 */
const char * get_now_day_ganzhi();

/**
 * create basic birth circle ui
 * @param parent                    the parent of the ui widgets in `lvgl`
 * @param radius                    (lv_coord_t) radius of the circle
 * @return                          true if success
 * @note                            the ui created will be center of the parent in default
 */
bool create_basic_birth_circle_ui(lv_obj_t *parent, lv_coord_t radius);

/**
 * create basic icon (people with heart) ui
 * @param parent                    the parent of the ui widgets in `lvgl`
 * @param zoom                      zoom value (default 1.0x), like 128(0.5x), 256(1.0x), 512(1.5x)....
 * @return                          true if success
 */
bool create_basic_icon_people_with_heart_ui(lv_obj_t *parent, uint16_t zoom = 256);

/**
 * create extend 2 body health param infomation ui
 * @param parent                    the parent in lvgl widget
 * @param x_ofs                     the offset in direction x from the center of parent
 * @param y_ofs                     the offset in direction y from the center of parent
 * @return                          true if success
 */
bool create_extend_2_body_health_param_info_ui(lv_obj_t *parent, lv_coord_t x_ofs, lv_coord_t y_ofs);

/**
 * create extend 1 local ellipse and earth moon ui with canvas
 * @param parent                    the parent of the ui widgets in `lvgl`
 * @param canvas                    the canvas to draw
 * @param c_start_x                 the x coord of start pos on canvas
 * @param c_start_y                 the y coord of start pos on canvas
 * @param c_use_w                   the width used on canvas
 * @param c_use_h                   the height used on canvas
 * @return                          true if success
 */
bool create_extend_2_body_psi_ui_with_canvas(lv_obj_t *parent, lv_obj_t *canvas, lv_coord_t c_start_x, lv_coord_t c_start_y, lv_coord_t c_use_w, lv_coord_t c_use_h);

/**
 * create extend 2 day ganzhi label ui
 * @param parent                    the parent in lvgl widget
 * @param x_ofs                     the offset in direction x from the center of parent
 * @param y_ofs                     the offset in direction y from the center of parent
 * @return                          true if success
 */
bool create_extend_2_day_ganzhi_label_ui(lv_obj_t *parent, lv_coord_t x_ofs, lv_coord_t y_ofs);

/**
 * create extend 2 guide text label ui
 * @param parent                    the parent in lvgl widget
 * @param x_ofs                     the offset in direction x from the center of parent
 * @param y_ofs                     the offset in direction y from the center of parent
 * @return                          true if success
 */
bool create_extend_2_guide_text_label_ui(lv_obj_t *parent, lv_coord_t x_ofs, lv_coord_t y_ofs);

/**
 * create extend 2 body yin yang ui with canvas
 * @param parent                    the parent of the ui widgets in `lvgl`
 * @param canvas                    the canvas to draw
 * @param c_start_x                 the x coord of start pos on canvas
 * @param c_start_y                 the y coord of start pos on canvas
 * @param c_use_w                   the width used on canvas
 * @param c_use_h                   the height used on canvas
 * @param r                         the radius of the circle
 * @return                          true if success
 */
bool create_extend_2_body_yin_yang_ui_with_canvas(lv_obj_t *parent, lv_obj_t *canvas, lv_coord_t c_start_x, lv_coord_t c_start_y, lv_coord_t c_use_w, lv_coord_t c_use_h, lv_coord_t r);

/**
 * create extend 2 body yin yang label ui
 * @param parent                    the parent in lvgl widget
 * @param x_ofs                     the offset in direction x from the center of parent
 * @param y_ofs                     the offset in direction y from the center of parent
 * @param gap_in_x                  the gap distance between yin label and yang label in x direction
 * @return                          true if success
 */
bool create_extend_2_body_yin_yang_label_ui(lv_obj_t *parent, lv_coord_t x_ofs, lv_coord_t y_ofs, lv_coord_t gap_in_x);

#endif // BIRTH_TIME_H
